<script setup lang="ts">

const props = defineProps({
  title: {
    type: String,
    default: " "
  },
  required: {
    type: Boolean,
    default: false
  }
});
</script>

<template>
  <div class="form-item-box">
    <div class="title" >
      {{ title }} <span v-if="required" class="required">*</span> :
    </div>
    <div class="value">
      <slot name="default"/>
    </div>
  </div>
</template>

<style scoped lang="scss">
.form-item-box {
  display: flex;
  align-items: center;
  padding: .5rem;
  .title {
    font-size: 1rem;
    font-weight: bolder;
  }

  .value {
    display: flex;
    justify-content: space-around;
    padding: 0 1rem;
  }
  .required {
    color: #f86060; /* 必填标记的颜色 */
    font-weight: bold; /* 可选：加粗 */
  }
}
</style>